<template>
	<view class="container">
		<view class="cellBox">
			<view class="list flex-ac">
				<view class="hd"><text style="color: red;">*</text>完成时间</view>
				<view class="md" @click="show = true">
					<input type="text" v-model="form.completeTime" disabled placeholder="请选择"  placeholder-style="color:#999">
				</view>
				<view class="bd">
					<u-icon name="arrow-right" size="24" color="#999"></u-icon>
				</view>
			</view>
			<u-picker mode="time" v-model="show" title="选择时间" :params="paramsTime" @confirm="addFuelTime"></u-picker>
			<view class="midBox" style="margin-top: 0;border-bottom: 1rpx solid #e5e5e5; ">
				<view class="image-tit"><text style="color: red;">*</text>使用材料</view>
				<view class="textBox">
					<view class="text">
						<textarea name="" v-model="form.usedMaterials" placeholder="请输入" placeholder-style="color:#CCCCCC" id="" cols="30" rows="10"></textarea>
					</view>
				</view>
			</view>
			<view class="list flex-ac" style="border-bottom: none;">
				<view class="hd"><text style="color: red;">*</text>维修费（元）</view>
				<view class="md">
					<input type="digit" v-model="form.repairCost" placeholder="请输入" placeholder-style="color:#999">
				</view>
			</view>
		</view>
		
		<view class="foot">
			<view class="btnBox flex-ac">
				<view class="btn-1 middle" @click="sureDone">确定</view>
			</view>
			<x-botSpace></x-botSpace>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				show: false,
				paramsTime: {
					year: true,
					month: true,
					day: true,
					hour: true,
					minute: true,
					second: true
				},
				form:{
					completeTime: '',
					id: '',
					repairCost: '',
					usedMaterials: ''
				}
			}
		},
		onLoad(opt) {
			if(opt) console.log('opt:', opt)
			this.form.id = opt.id
			this.form.completeTime = this.$Common.formatTime(this.$Common.currentTime(), "Y-M-D h:m:s").replaceAll('-', '/')
		},
		methods: {
			sureDone(){
				if(this.form.repairCost === '') return this.$Toast.message('请完善信息')
				if(this.form.usedMaterials === '') return this.$Toast.message('请完善信息')
				this.$Net.post('/carRepair/finish', this.form).then(res=>{
					this.$Toast.messageIcon('操作成功')
					setTimeout(()=>{
						this.$Jump.Back(1)
					}, 1000)
				})
			},
			addFuelTime(e){
				this.form.completeTime = e.year + "/" + e.month + '/' + e.day + ' ' + e.hour + ":" + e.minute + ":" + e.second 
			},
		}
	}
</script>

<style lang="scss">
	page{ background-color: #f9f9f9; }
</style>

<style lang="scss" scoped>
	// @import './style.scss';
	.foot {
		width: 100%;
		padding: 30rpx;
		padding-top: 120rpx;
		.btnBox {
			width: 100%;
	
			.btn-1 {
				flex: 1;
				height: 90rpx;
				background: #1684FC;
				border-radius: 10rpx;
				color: #ffffff;
				font-size: 34rpx;
			}
	
			.btn-2 {
				flex: 1;
				height: 90rpx;
				border: 1px solid #1684FC;
				border-radius: 10rpx;
				color: #1684FC;
				font-size: 34rpx;
			}
		}
	}
	.container{
		width: 100%;
		.midBox{
			padding: 24rpx;
			.textBox{
				width: 100%;
				margin-top: 32rpx;
				padding: 0 24rpx;
				padding-bottom: 32rpx;
				.text{
					border-radius: 8rpx;
					padding: 16rpx;
					width: 100%;
					height: 248rpx;
					background-color: #F6F6F6;
					textarea{
						width: 100%;
						height: 100%;
					}
				}
			}
		}
		.cellBox{
			width: 100%;
			background-color: #fff;
			.list{
				width: 100%;
				height: 96rpx;
				padding-right: 24rpx;
				padding-left: 24rpx;
				border-bottom: 1rpx solid #e5e5e5;
				.hd{
					width: 234rpx;
					color: #333;
				}
				.md{
					flex: 1;
					height: 100%;
					input{
						width: 100%;
						height: 100%;
						line-height: 94rpx;
						text-align: right;
						padding-right: 20rpx;
					}
				}
				.bd{
					color: #999;
					image{
						width: 30rpx;
						height: 30rpx;
					}
				}
			}
		}
	}
</style>
